﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CApC3DRootNodeData
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections;
using System.Collections.Generic;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;


namespace DnProcessSimulateCommands;

internal class CApC3DRootNodeData : CApC3DProcessNodeData
{
  private CApC3DAttachmentManager m_attachementManager;
  private CApDataFileReader m_reader;

  internal CApC3DRootNodeData(ITxOperation nodeObject)
    : base(nodeObject, (CApC3DProcessNodeData) null)
  {
    this.m_attachementManager = !TxTcUtilities.IsTcAnyPlatform ? (CApC3DAttachmentManager) new CApC3DEMSAttachmentManager(this) : (CApC3DAttachmentManager) new CApC3DTCAttachmentManager(this);
    this.m_attachementManager.Initialize();
  }

  internal bool DoesHave3DAttachment => this.m_attachementManager.DoesHave3D;

  internal void Set3DAttachment(
    string newU3DFile,
    string newJSFile,
    string newViewDataFile,
    string newViewNodesFile)
  {
    this.m_attachementManager.Set3D(newU3DFile, newJSFile, newViewDataFile, newViewNodesFile);
  }

  internal CApDataFileReader DataReader
  {
    get => this.m_reader;
    set => this.m_reader = value;
  }

  internal CApC3DDocumentationSettings GetDocumentationSettings()
  {
    CApC3DDocumentationSettings ddocumentationSettings = new CApC3DDocumentationSettings();
    return this.m_reader == null ? new CApC3DDocumentationSettings() : this.m_reader.GetDocumentationSettings();
  }

  internal void FillAllSteps()
  {
    Hashtable stepsList = new Hashtable();
    if (this.m_reader != null)
      this.m_reader.GetAllSteps(ref stepsList);
    this.MarkSteps(ref stepsList, new List<CApC3DProcessNodeData>()
    {
      (CApC3DProcessNodeData) this
    });
  }

  private void MarkSteps(ref Hashtable stepsList, List<CApC3DProcessNodeData> operations)
  {
    foreach (CApC3DProcessNodeData operation in operations)
    {
      if (stepsList.ContainsKey((object) ((ITxObject) operation.NodeObject).Id))
      {
        operation.IsStep = true;
        if (stepsList[(object) ((ITxObject) operation.NodeObject).Id] is CApC3DSnapshotNodeData dsnapshotNodeData)
          operation.AttachedSnapshotData = dsnapshotNodeData;
      }
      this.MarkSteps(ref stepsList, operation.GetChildren(true));
    }
  }
}
